
'use client'
import Image from 'next/image'
import myImage from '../../public/psc1.jpg'
import styles from './styles.module.css'


const data = await fetch('https://api.apihubs.cn/holiday/get')
const json =  await data.json();



export default async function page() {

  
    console.log(json)
    if(!json.data.list){
      json.data.list = [{'year':2022,'lunar_date':'2022年元旦'},{'year':2022,'lunar_date':'2022年春节'}]
    }

    return <div className={styles.blog}>
        <b className='text-3xl'>Hello blog {json.total}</b>
        <Image src={myImage} width={200} height={200} alt=''/>
      <ul>
        {json.data.list.map((obj) => (
          <li key={obj.year}>{obj.lunar_date}</li>
        ))}
      </ul>

        <Image
      src="https://s3.amazonaws.com/my-bucket/profile.png"
      alt="Picture of the author"
      width={500}
      height={500}
    />  
        </div>

}
